# 需求：匹配分机号码
import re
text = "0571-88776655-9527.dfvgai;;sdbv;asdv;asv;iasvi021-8877665;cav"
parter = "\d{4}-\d{8}-\d{4}"
# parter  = "\d{3,4}-\d{7,8}-\d{3,4}|\d{3,4}-\d{7,8}"
result = re.findall(parter, text)
print(result)

# 需求：所以整个正则表达式 打扫餐(\.|。)?$ 将会匹配所有以 "打扫餐"、"打扫餐." 或者 "打扫餐。" 结尾的字符串。
# 目标字符串
s1 = "打扫餐"
s2 = "我要打扫餐."
s3 = "打扫餐厅"

rerule = "打扫餐(\.|。)?$"
# 使用正则表达式替换
s1 = re.sub(rerule, '打扫餐厅', s1)
new_s2 = re.sub(rerule, '打扫餐厅', s2)
new_s3 = re.sub(rerule, '打扫餐厅', s3)

print(s1)  # 输出: "我要打扫餐厅"
print(new_s2)  # 输出: "我要打扫餐厅"
print(new_s3)  # 输出: "我要打扫餐厅"


def extract_content_after_last_underscore(input_string):
    split_string = re.split('_', input_string)
    return split_string[-1]


input_string = ""
print(extract_content_after_last_underscore(input_string))
